package com.butterfly.demo.serviceImpl;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.butterfly.demo.model.Courses;
import com.butterfly.demo.model.Student;
/**
 * @author ZhengGuang Dong
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:applicationContext.xml"})
public final  class EntityDaoTest{
	private HibernateTemplate hibernateTemplate; 
    private StudentServiceImpl serviceImpl;
    @Test
    public void testSave() throws Exception {
    	Student student2 = new Student();
		student2.setUsername("zhaojing");
		student2.setPassword("hahahah");
		
		Courses courses = new Courses();
		courses.setCoursesName("java");
		
//		//Syllabus syllabus = new Syllabus();
//		syllabus.setCourses(courses);
//		syllabus.setStudent(student2);
//		syllabus.setScore(100);
		
		
	//	hibernateTemplate.save(syllabus);
    }
    @Autowired
	public void setServiceImpl(StudentServiceImpl serviceImpl) {
		this.serviceImpl = serviceImpl;
	}
    @Autowired
	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}
	public HibernateTemplate getHibernateTemplate() {
		return hibernateTemplate;
	}
    
    
}
